package a.j.a;

import a.c.*;
import a.c.e;
import a.c.m;
import a.c.q;
import a.j.g;
import a.j.ic;
import a.j.mg;

import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultTreeSelectionModel;
import javax.swing.tree.TreePath;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;

public class t
  extends DefaultTreeSelectionModel
{
  j a;
  private boolean b;
  private e_ c;
  private c_ d;
  public static int e;
  
  public boolean a()
  {
    return this.b;
  }
  
  public void a(boolean paramBoolean)
  {
    this.b = paramBoolean;
  }
  
  public t(j paramj)
  {
    this.a = paramj;
    ArrayList localArrayList = new ArrayList();
    this.c = new e_(null);
    a(paramj.j(), paramj, new d_()
    {
      private final ArrayList val$selected;
      
      public void a(q paramAnonymousq)
      {
        int i = j.v;
        boolean bool = j.u;
        paramAnonymousq.a(t.this.c);
        if ((i != 0) || ((paramAnonymousq instanceof g)))
        {
          g localg = (g)paramAnonymousq;
          localg.a(t.this.c);
          w localw = localg.v();
          do
          {
            if (!localw.e()) {
              break;
            }
            if (i == 0)
            {
              if (localg.y(localw.d())) {
                this.val$selected.add(localw.d());
              }
              localw.f();
            }
          } while (!bool);
        }
      }
    });
    if (i == 0)
    {
      if (!localArrayList.isEmpty())
      {
        q localq = paramj.j();
        this.c.a(new cb(localq, (byte)12, null));
        Iterator localIterator = localArrayList.iterator();
        if (localIterator.hasNext()) {}
        while (i != 0)
        {
          e locale = (e)localIterator.next();
          this.c.onGraph2DSelectionEvent(new mg((g)locale.g(), locale));
          if ((i == 0) && (bool)) {
            return;
          }
          if (!bool) {
            break;
          }
        }
        this.c.a(new cb(localq, (byte)13, null));
      }
      this.d = new c_(null);
    }
    addTreeSelectionListener(this.d);
  }
  
  public void b()
  {
    removeTreeSelectionListener(this.d);
    this.d = null;
    a(this.a.j(), this.a, new d_()
    {
      public void a(q paramAnonymousq)
      {
        paramAnonymousq.b(t.this.c);
        if ((j.v != 0) || ((paramAnonymousq instanceof g))) {
          ((g)paramAnonymousq).b(t.this.c);
        }
      }
    });
    this.c = null;
    this.a = null;
  }
  
  private static void a(q paramq, j paramj, d_ paramd_)
  {
    int i = j.v;
    boolean bool = j.u;
    w localw = paramq.v();
    do
    {
      if (!localw.e()) {
        break;
      }
      e locale = localw.d();
      if ((i == 0) && (bool)) {
        return;
      }
      if (i == 0)
      {
        if (paramj.l(locale)) {
          a(paramj.o(locale), paramj, paramd_);
        }
        localw.f();
      }
    } while (!bool);
    if (i == 0) {
      paramd_.a(paramq);
    }
  }
  
  void a(Collection paramCollection)
  {
    int i = j.v;
    boolean bool = j.u;
    label98:
    do
    {
      Iterator localIterator = paramCollection.iterator();
      do
      {
        Object localObject;
        do
        {
          if (!localIterator.hasNext()) {
            break;
          }
          do
          {
            localTreePath = (TreePath)localIterator.next();
            if (localTreePath == null) {
              break;
            }
            localObject = localTreePath.getLastPathComponent();
          } while (i != 0);
        } while (bool);
        if ((!(localObject instanceof e)) || (((e)localObject).g() != null)) {
          break;
        }
        localIterator.remove();
        if (i != 0) {
          break label98;
        }
      } while (!bool);
      TreePath localTreePath = localTreePath.getParentPath();
    } while (!bool);
  }
  
  private class c_
    implements TreeSelectionListener
  {
    private c_() {}
    
    public void valueChanged(TreeSelectionEvent paramTreeSelectionEvent)
    {
      int j = j.v;
      boolean bool = j.u;
      TreePath[] arrayOfTreePath = paramTreeSelectionEvent.getPaths();
      HashSet localHashSet = new HashSet();
      int i = 0;
      Object localObject1;
      label218:
      label219:
      label221:
      do
      {
        if (i >= arrayOfTreePath.length) {
          break;
        }
        localObject1 = arrayOfTreePath[i];
        Object localObject2 = ((TreePath)localObject1).getLastPathComponent();
        if (bool) {
          break label280;
        }
        if ((localObject2 instanceof e))
        {
          e locale = (e)localObject2;
          g localg = (g)locale.g();
          if (j != 0) {
            continue;
          }
          if (localg != null)
          {
            if (j == 0) {
              if (paramTreeSelectionEvent.isAddedPath((TreePath)localObject1))
              {
                if (j != 0) {
                  continue;
                }
                if (localg.y(locale)) {
                  break label261;
                }
                if (j == 0)
                {
                  if (!t.this.b)
                  {
                    m localm = localg.S();
                    if (j != 0) {
                      break label218;
                    }
                    if (localm.e()) {
                      do
                      {
                        if (!localm.e()) {
                          break;
                        }
                        localg.a(localm.a(), false);
                        localm.f();
                        if (j != 0) {
                          break label221;
                        }
                        if (bool) {
                          break label219;
                        }
                      } while (!bool);
                    }
                  }
                  localg.a(locale, true);
                  if (j != 0) {
                    break label221;
                  }
                }
                localHashSet.add(localg);
                if (j != 0) {
                  continue;
                }
                if (!bool) {
                  break label261;
                }
              }
            }
            if (j != 0) {
              continue;
            }
            if (localg.y(locale))
            {
              localg.a(locale, false);
              localHashSet.add(localg);
            }
          }
        }
        i++;
      } while (!bool);
      label261:
      if ((j != 0) || (localHashSet.size() > 0))
      {
        label280:
        Iterator localIterator = localHashSet.iterator();
        do
        {
          if (!localIterator.hasNext()) {
            break;
          }
          localObject1 = (g)localIterator.next();
          ((g)localObject1).gb();
        } while (!bool);
      }
    }
    
    c_(t.1 param1)
    {
      this();
    }
  }
  
  private class e_
    implements ic, u
  {
    int a = 0;
    Collection b = new HashSet();
    Collection c = new HashSet();
    
    private e_() {}
    
    public void onGraph2DSelectionEvent(mg parammg)
    {
      int i = j.v;
      boolean bool = j.u;
      if ((i != 0) || ((parammg.d() instanceof e)))
      {
        e locale = (e)parammg.d();
        TreePath localTreePath = new TreePath(t.this.a.b(locale));
        localTreePath = localTreePath.pathByAddingChild(locale);
        if (i == 0) {
          if (parammg.e().y(locale))
          {
            if (i == 0) {
              if (this.a > 0)
              {
                this.b.add(localTreePath);
                this.c.remove(localTreePath);
                if (i == 0) {
                  if (!bool) {
                    return;
                  }
                }
              }
              else
              {
                t.this.addSelectionPath(localTreePath);
              }
            }
            if (i == 0) {
              if (!bool) {
                return;
              }
            }
          }
          else
          {
            if (i != 0) {
              break label181;
            }
          }
        }
        if (this.a > 0)
        {
          this.c.add(localTreePath);
          if (i != 0) {
            break label181;
          }
          this.b.remove(localTreePath);
          if (!bool) {
            return;
          }
        }
        label181:
        t.this.removeSelectionPath(localTreePath);
      }
    }
    
    public void a(cb paramcb)
    {
      int i = j.v;
      boolean bool = j.u;
      if (i == 0) {
        if (paramcb.a() == 12)
        {
          this.a += 1;
          if ((i == 0) && (!bool)) {
            return;
          }
        }
      }
      if (i == 0) {
        if (paramcb.a() == 13)
        {
          this.a -= 1;
          if (i == 0)
          {
            if (this.a != 0) {
              return;
            }
            t.this.a(this.b);
          }
          if (i == 0)
          {
            if (!this.b.isEmpty())
            {
              t.this.addSelectionPaths((TreePath[])this.b.toArray(new TreePath[this.b.size()]));
              this.b.clear();
            }
            t.this.a(this.c);
          }
          if (i == 0)
          {
            if (this.c.isEmpty()) {
              return;
            }
            t.this.removeSelectionPaths((TreePath[])this.c.toArray(new TreePath[this.c.size()]));
            this.c.clear();
          }
        }
      }
      if (((i == 0) && ((bool) && (i != 0))) || (paramcb.a() == 6))
      {
        e locale = (e)paramcb.b();
        g localg = (g)locale.g();
        TreePath localTreePath = new TreePath(t.this.a.b(locale));
        localTreePath = localTreePath.pathByAddingChild(locale);
        if (i == 0) {
          if (localg.y(locale))
          {
            if (i == 0) {
              if (this.a > 0)
              {
                this.b.add(localTreePath);
                this.c.remove(localTreePath);
                if (i == 0) {
                  if (!bool) {
                    return;
                  }
                }
              }
              else
              {
                t.this.addSelectionPath(localTreePath);
              }
            }
            if (i == 0) {
              if (!bool) {
                return;
              }
            }
          }
          else
          {
            if (i != 0) {
              break label409;
            }
          }
        }
        if (this.a > 0)
        {
          this.c.add(localTreePath);
          if (i != 0) {
            break label409;
          }
          this.b.remove(localTreePath);
          if (!bool) {
            return;
          }
        }
        label409:
        t.this.removeSelectionPath(localTreePath);
      }
    }
    
    e_(t.1 param1)
    {
      this();
    }
  }
  
  private static abstract interface d_
  {
    public abstract void a(q paramq);
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.j.a.t

 * JD-Core Version:    0.7.0.1

 */